<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
            width:200px;
            height:100px;
            border:solid 2px #f00;
            background:#00f;
            color:#fff;
            transition: all 5s;
        }
        .test{
            border:5px dashed #00f;
            background:#f00;
        }
    </style>
    <script>
        function showDiv(){
            var div = document.querySelector('div');
            // div.style.display="block";
            div.className = "test";
        }
    </script>
</head>
<body>
    <button onclick="showDiv()">点击</button>
    <div>
        这是一个文字div
    </div>
</body>
</html>